#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    move(300,200);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_up_clicked()
{
    //点击一次让pushButton向上移动10像素
    QRect rect = ui->pushButton->geometry();
    ui->pushButton->setGeometry(rect.x(),rect.y() - 10,rect.width(),rect.height());
}

void Widget::on_pushButton_right_clicked()
{
    //点击一次让pushButton向上移动10像素
    QRect rect = ui->pushButton->geometry();
    ui->pushButton->setGeometry(rect.x() + 10,rect.y(),rect.width(),rect.height());
}

void Widget::on_pushButton_left_clicked()
{
    QRect rect = ui->pushButton->geometry();
    ui->pushButton->setGeometry(rect.x() - 10,rect.y(),rect.width(),rect.height());
}

void Widget::on_pushButton_dwon_clicked()
{
    QRect rect = ui->pushButton->geometry();
    ui->pushButton->setGeometry(rect.x(),rect.y() + 10,rect.width(),rect.height());
}
